/*
 * StructureXML.h
 *
 *  Created on: 2011-3-20
 *      Author: xdu
 */

#ifndef STRUCTUREXML_H_
#define STRUCTUREXML_H_

#include <string>
#include <list>

using namespace std;

class AttributXml
{
public:

	string GetName();
	string GetValue();
	void Afficher();
	AttributXml();
	AttributXml(string name, string value);


private:

	string name;
	string value;
};

class ElementXml
{
public:
	string GetName() { return name; }
	ElementXml& AddChild(const ElementXml& element);
	ElementXml& AddChild(const string& name, const string& contents);
	void SetChildList(const list<ElementXml>& childs);
	void AddAttribute(const string& name, const string& value);
	list<ElementXml> GetChildList();
	list<AttributXml> GetAttributeList();
	void SetAttributeList(list<AttributXml> list);
	void Afficher();
	ElementXml();
	ElementXml(const string& name);
	ElementXml(const string& name, const string& contents, int level = 0);
	//code a nous
	ElementXml seekMatchAttValue(string value);
	string GetContent() { return contents; }
	void AddContent(string content);
	int GetLevel() { return level; }
	void AddChildren(list<ElementXml> elements);
	void RemoveBack();

private:

	string name;
	string contents;
	int level;
	list<ElementXml> childs;
	list<AttributXml> attributes;
};

class StructureXml
{
public:

	void Afficher();
	ElementXml& GetRoot();
	StructureXml();
	StructureXml(const ElementXml& element);
	StructureXml(string name, string contents);

private:

	ElementXml root;
};



#endif /* STRUCTUREXML_H_ */
